<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="jpath" value="${pageContext.request.contextPath }"/>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>后台框架</title>
		<%@include  file="css.jsp"%>
	
	</head>

	<body>
					<div class="page-content">
						<div class="page-header">
							<h1>
								控制台
								<small>
									<i class="icon-double-angle-right"></i>
									 查看
								</small>
							</h1>
						</div><!-- /.page-header -->

						<div class="row">
							<div class="col-xs-12">
								<form class="form-horizontal" id="stuForm"  method="post" action="" role="form">
									<input type="hidden" id="id" name="id" value="12346"/>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">姓名</label>

										<div class="col-sm-9">
											<input type="text" id="stuname" name="stuname" placeholder="姓名" class="col-xs-10 col-sm-5" />
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">性别</label>

										<div class="col-sm-9">
											<input type="text" id="sex" name="sex"  placeholder="性别" class="col-xs-10 col-sm-5" />
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">年龄</label>

										<div class="col-sm-9">
											<input type="text" id="age" name="age"  placeholder="年龄" class="col-xs-10 col-sm-5" />
										</div>
									</div>
									<div class="clearfix form-actions">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info" id="submitBtn"  type="button">
												<i class="icon-ok bigger-110"></i>
												提交
											</button>

											&nbsp; &nbsp; &nbsp;
											<button class="btn" type="reset">
												<i class="icon-undo bigger-110"></i>
												刷新
											</button>
										</div>
									</div>

									
								</form>
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
<%@include  file="js.jsp"%>
<script type="text/javascript">
	
	$("#submitBtn").click(function(){
		console.log("欧克");
		var dataJson="";
		var dataArr=[];
		$("#stuForm").find("input").each(function(e,_this){
			var iptName=$(_this).attr("name");
			if(iptName!="" && iptName!=null){
				dataArr.push(iptName+":'"+$(_this).val()+"'");
			}
		});
		dataJson+="{"+dataArr.join(",")+"}";
		var jsonForms=eval("("+dataJson+")");

		
		$.post("${jpath}/studentcontorller/add",jsonForms,function(data){
				console.log(data);
				var json=$.parseJSON(data);
				alert(json.resMsg);
			}
		);
	});
</script>
</body>
</html>
